﻿
namespace Proto.Fields{
    using System.Runtime.InteropServices;
    using System;

    
	[StructLayout( LayoutKind.Sequential )]
	public partial struct RIC : IComparable<RIC>, IColumnCompatible
	{
        public static readonly RIC FAIL = new RIC(){ 
            m_Value = String.Empty,
            //m_DataQuality = DataQualityTypes.Fail,
        };
        public const FieldID FIELD_ID = FieldID.RIC;
        public FieldID FieldID{ get{ return FIELD_ID; } }
		private String m_Value;
		public String Value { get { return m_Value; } }
		
        //private DataQualityTypes m_DataQuality;
        //public DataQualityTypes DataQuality{ get{ return m_DataQuality; } }

        public static implicit operator  String ( RIC lhs ) { return lhs.m_Value; }
		public static explicit operator RIC( String value ) { return new RIC{m_Value = value}; }

        public override bool Equals(object obj)
        {
            if( obj is RIC ) return Equals(( RIC ) obj );
            return base.Equals(obj);
        }

	    public bool Equals(RIC other)
	    {
            if( ReferenceEquals( other.m_Value, this.m_Value ) ) return true;
	        
            return other.m_Value.Equals( this.m_Value );
	    }

	    public override int GetHashCode()
	    {
	        return this.m_Value.GetHashCode();
	    }

		public override string ToString() { return this.m_Value.ToString(); }

	    public int CompareTo( RIC other ) { return m_Value.CompareTo( other.m_Value ); }
	}
	[StructLayout( LayoutKind.Sequential )]
	public partial struct Quantity : IComparable<Quantity>, IColumnCompatible
	{
        public static readonly Quantity FAIL = new Quantity(){ 
            m_Value = int.MinValue,
            //m_DataQuality = DataQualityTypes.Fail,
        };
        public const FieldID FIELD_ID = FieldID.Quantity;
        public FieldID FieldID{ get{ return FIELD_ID; } }
		private int m_Value;
		public int Value { get { return m_Value; } }
		
        //private DataQualityTypes m_DataQuality;
        //public DataQualityTypes DataQuality{ get{ return m_DataQuality; } }

        public static implicit operator  int ( Quantity lhs ) { return lhs.m_Value; }
		public static explicit operator Quantity( int value ) { return new Quantity{m_Value = value}; }
		public static Quantity operator +( Quantity lhs, Quantity rhs ){
			return new Quantity(){m_Value= lhs.m_Value + rhs.m_Value};
		}
		public static Quantity operator -( Quantity lhs, Quantity rhs ){
			return new Quantity(){m_Value= lhs.m_Value - rhs.m_Value};
		}
	
		public static Quantity operator ++( Quantity lhs ){
            lhs.m_Value++;
            return lhs;
		}
		public static Quantity operator --( Quantity lhs ){
            lhs.m_Value--;
            return lhs;
		}

        public override bool Equals(object obj)
        {
            if( obj is Quantity ) return Equals(( Quantity ) obj );
            return base.Equals(obj);
        }

	    public bool Equals(Quantity other)
	    {
	        return other.m_Value == this.m_Value;
	    }

	    public override int GetHashCode()
	    {
	        return this.m_Value.GetHashCode();
	    }

		public override string ToString() { return this.m_Value.ToString(); }

	    public int CompareTo( Quantity other ) { return m_Value.CompareTo( other.m_Value ); }
	}
	[StructLayout( LayoutKind.Sequential )]
	public partial struct Price : IComparable<Price>, IColumnCompatible
	{
        public static readonly Price FAIL = new Price(){ 
            m_Value = double.MinValue,
            //m_DataQuality = DataQualityTypes.Fail,
        };
        public const FieldID FIELD_ID = FieldID.Price;
        public FieldID FieldID{ get{ return FIELD_ID; } }
		private double m_Value;
		public double Value { get { return m_Value; } }
		
        //private DataQualityTypes m_DataQuality;
        //public DataQualityTypes DataQuality{ get{ return m_DataQuality; } }

        public static implicit operator  double ( Price lhs ) { return lhs.m_Value; }
		public static explicit operator Price( double value ) { return new Price{m_Value = value}; }
		public static Price operator +( Price lhs, Price rhs ){
			return new Price(){m_Value= lhs.m_Value + rhs.m_Value};
		}
		public static Price operator -( Price lhs, Price rhs ){
			return new Price(){m_Value= lhs.m_Value - rhs.m_Value};
		}
	
		public static Price operator ++( Price lhs ){
            lhs.m_Value++;
            return lhs;
		}
		public static Price operator --( Price lhs ){
            lhs.m_Value--;
            return lhs;
		}

        public override bool Equals(object obj)
        {
            if( obj is Price ) return Equals(( Price ) obj );
            return base.Equals(obj);
        }

	    public bool Equals(Price other)
	    {
	        return other.m_Value == this.m_Value;
	    }

	    public override int GetHashCode()
	    {
	        return this.m_Value.GetHashCode();
	    }

		public override string ToString() { return this.m_Value.ToString(); }

	    public int CompareTo( Price other ) { return m_Value.CompareTo( other.m_Value ); }
	}
	[StructLayout( LayoutKind.Sequential )]
	public partial struct ExposureRIC : IComparable<ExposureRIC>, IColumnCompatible
	{
        public static readonly ExposureRIC FAIL = new ExposureRIC(){ 
            m_Value = RIC.FAIL,
            //m_DataQuality = DataQualityTypes.Fail,
        };
        public const FieldID FIELD_ID = FieldID.ExposureRIC;
        public FieldID FieldID{ get{ return FIELD_ID; } }
		private RIC m_Value;
		public RIC Value { get { return m_Value; } }
		
        //private DataQualityTypes m_DataQuality;
        //public DataQualityTypes DataQuality{ get{ return m_DataQuality; } }

        public static implicit operator  RIC ( ExposureRIC lhs ) { return lhs.m_Value; }
		public static explicit operator ExposureRIC( RIC value ) { return new ExposureRIC{m_Value = value}; }

        public override bool Equals(object obj)
        {
            if( obj is ExposureRIC ) return Equals(( ExposureRIC ) obj );
            return base.Equals(obj);
        }

	    public bool Equals(ExposureRIC other)
	    {
            if( ReferenceEquals( other.m_Value, this.m_Value ) ) return true;
	        return other.m_Value == this.m_Value;
	    }

	    public override int GetHashCode()
	    {
	        return this.m_Value.GetHashCode();
	    }

		public override string ToString() { return this.m_Value.ToString(); }

	    public int CompareTo( ExposureRIC other ) { return m_Value.CompareTo( other.m_Value ); }
	}
	[StructLayout( LayoutKind.Sequential )]
	public partial struct BookCode : IComparable<BookCode>, IColumnCompatible
	{
        public static readonly BookCode FAIL = new BookCode(){ 
            m_Value = String.Empty,
            //m_DataQuality = DataQualityTypes.Fail,
        };
        public const FieldID FIELD_ID = FieldID.BookCode;
        public FieldID FieldID{ get{ return FIELD_ID; } }
		private String m_Value;
		public String Value { get { return m_Value; } }
		
        //private DataQualityTypes m_DataQuality;
        //public DataQualityTypes DataQuality{ get{ return m_DataQuality; } }

        public static implicit operator  String ( BookCode lhs ) { return lhs.m_Value; }
		public static explicit operator BookCode( String value ) { return new BookCode{m_Value = value}; }

        public override bool Equals(object obj)
        {
            if( obj is BookCode ) return Equals(( BookCode ) obj );
            return base.Equals(obj);
        }

	    public bool Equals(BookCode other)
	    {
            if( ReferenceEquals( other.m_Value, this.m_Value ) ) return true;
	        return other.m_Value == this.m_Value;
	    }

	    public override int GetHashCode()
	    {
	        return this.m_Value.GetHashCode();
	    }

		public override string ToString() { return this.m_Value.ToString(); }

	    public int CompareTo( BookCode other ) { return m_Value.CompareTo( other.m_Value ); }
	}
}